Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

has-values

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

has-values

Returns true if any values exist, false if empty. Works for booleans, functions, numbers, strings, nulls, objects and arrays.

  • 0.1.4
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is has-values?

The has-values npm package is a utility that checks if a value exists and is not empty. It can be used to validate objects, arrays, strings, and other data types to ensure they contain meaningful data.

What are has-values's main functionalities?

Check if a string has a value

This feature allows you to check if a string is non-empty. It returns true if the string has a value and false if it is empty.

const hasValues = require('has-values');
console.log(hasValues('hello')); // true
console.log(hasValues('')); // false

Check if an array has values

This feature checks if an array contains any elements. It returns true if the array has elements and false if it is empty.

const hasValues = require('has-values');
console.log(hasValues([1, 2, 3])); // true
console.log(hasValues([])); // false

Check if an object has values

This feature checks if an object has any properties. It returns true if the object has properties and false if it is empty.

const hasValues = require('has-values');
console.log(hasValues({a: 1, b: 2})); // true
console.log(hasValues({})); // false

Check if a nested object has values

This feature checks if a nested object contains any values. It returns true if the nested object has values and false if it is empty.

const hasValues = require('has-values');
console.log(hasValues({a: {b: 2}})); // true
console.log(hasValues({a: {}})); // false

Other packages similar to has-values

Keywords

FAQs

Package last updated on 27 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc